//
//  LLBasicModel.h
//  LLFutureLife
//
//  Created by Tomy on 13-7-9.
//  Copyright (c) 2013年 ZhiHai. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <objc/message.h>
#import "NSObject+Properties.h"
#import "LLModelClassProperty.h"

#pragma mark - Property Protocols
/**
 * Protocol for defining optional properties in a JSON Model class. Use like below to define
 * model properties that are not required to have values in the JSON input:
 *
 * @property (strong, nonatomic) NSString&lt;Optional&gt;* propertyName;
 *
 */
@protocol Optional
@end

/**
 * Protocol for defining index properties in a JSON Model class. Use like below to define
 * model properties that are considered the Model's identifier (id).
 *
 * @property (strong, nonatomic) NSString&lt;Index&gt;* propertyName;
 *
 */
@protocol Index
@end

/**
 * ConvertOnDemand enables lazy model initialization for NSArrays of models
 *
 * @property (strong, nonatomic) NSArray&lt;JSONModel, ConvertOnDemand&gt;* propertyName;
 */
@protocol ConvertOnDemand
@end

@protocol xgMiss
@end

@protocol AbstractJSONModelProtocol <NSObject>

- (id)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary*)toDictionary;

@end

@interface LLBasicModel : NSObject

@property (nonatomic, retain) NSDictionary *primaryKeys;

- (id)initWithJSONString:(NSString *)jsonString;
- (id)initWithDictionary:(NSDictionary *)dict;

- (NSDictionary*)toDictionary;
- (NSString *)toJSONString;
- (NSData *)toJSONData;

+ (NSArray *)getClassProperty:(Class)zclass;

@end
